package cn.cj.controller;

import java.io.IOException;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.cj.service.FindCondition;
import cn.cj.vo.PageBean;

@Controller
public class FindConditionController {
    @Resource
    FindCondition findCondition;

    /**
     * 爬取输入关键字
     *
     * @param string
     * @return
     */
    @RequestMapping(value = "FindConditionJSON", produces = "text/html;charset=UTF-8")
    public @ResponseBody
    String FindConditionJSON(String string) {

        String message = "程序异常!";
        try {
            message = findCondition.search(string);

        } catch (IOException e) {
            e.printStackTrace();
        }
        return message;
    }

    /**
     * 获取对像列表
     *
     * @param string
     * @return
     */
    @RequestMapping(value = "getJobBean", produces = "text/html;charset=UTF-8")
    public @ResponseBody
    String getJobBean(PageBean pageBean) {
        return findCondition.getJobBean(pageBean);
    }

    /**
     * 屏蔽对应公司
     *
     * @param string
     * @return
     */
    @RequestMapping(value = "shieldingCompany", produces = "text/html;charset=UTF-8")
    public @ResponseBody
    String shieldingCompany(String string) {

        return findCondition.shieldingCompany(string);
    }

    /**
     * 获取分页总数
     *
     * @param string
     * @return
     */
    @RequestMapping(value = "totalPages", produces = "text/html;charset=UTF-8")
    public @ResponseBody
    String totalPages(String string) {
        return findCondition.totalPages(string);
    }

}
